package org.example.pms.controller;

import org.example.pms.domain.Patient;
import org.example.pms.domain.User;
import org.example.pms.service.PatientService;
import org.example.pms.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @Resource
    private PatientService patientService;

    @RequestMapping("/test")
    public List<User> test() {

        List<User> users = userService.test();
        return users;
    }


    @RequestMapping("/getPatients")
    public List<Patient> getPatient() {
        Patient patient = new Patient();
        patient.setId(1);

        List<Patient> patients = patientService.getPatients(patient);

        return patients;
    }


    @PostMapping("/login")
    public Boolean login(@RequestParam("username") String username, @RequestParam("password") String password) {
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);

        Boolean login = userService.login(user);
//        List<PatientCaseVo> patientCases = userService.getPatientCase(user);
        return login;
    }


}
